#pragma once

#include "Drawer.h"
#include "TrueText/OutlineInfo.h"
#include <boost/smart_ptr/shared_ptr.hpp>
#include "BlittingFunction.h"

namespace TrueText {

class FontImpl;
class OutlineInfo;

class OutlineDrawer : public Drawer
{
public:
	OutlineDrawer(boost::shared_ptr<FontImpl> font, boost::shared_ptr<Drawer> textDrawer, const OutlineInfo& outlineInfo);

	virtual Rectangle GetBounds(const TextLayout& layout);
	virtual boost::shared_ptr<BitmapLayer> Draw(const TextLayout& layout);
	void SetBlendMode(BlendMode value) { this->blendMode = value; }
private:
	boost::shared_ptr<BitmapLayer> DoDraw(const TextLayout& layout);

	boost::shared_ptr<FontImpl> font;
	boost::shared_ptr<Drawer> textDrawer;
	OutlineInfo outlineInfo;

	boost::shared_ptr<BitmapLayer> cacheLayer;
	const TextLayout* cacheLayout;
	Rectangle cacheBounds;
	BlendMode blendMode;
};

}